import 'package:flutter_magic_planet/common/http/api_comic_pingcc.dart';
import 'package:flutter_magic_planet/model/comic_content.dart';
import 'package:get/get.dart';

class ComicPlayerLogic extends GetxController {
  String? chapterId;
  final comic = ComicContent().obs;

  ComicPlayerLogic({this.chapterId});

  @override
  void onInit() {
    chapterId = Get.parameters['chapterId'];
    fetchContent();
    super.onInit();
  }

  fetchContent() async {
    var _data = await APIComicPingcc.getComicContent(id: chapterId!);
    comic.value = _data ?? ComicContent();
  }
}
